#pragma once
#include <lcir/IR/Prototype.h>
#include <lcir/IR/Value.h>
#include <lcir/IR/Context.h>

#include <memory>
namespace lcir {
class Prototype;
class Constant : public ValueCRTP<Constant> {
  friend GlobalContext;
  Constant(std::unique_ptr<Prototype> proto) : ValueCRTP(ValueKind::VK_Constant) {
    Value::proto = std::move(proto);
    Value::proto->setValue(this);
  }
 public:
  static Constant* get(std::unique_ptr<Prototype> proto) {
    auto *ctx = GlobalContext::get();
    return ctx->getConst(std::move(proto));
  }

  std::string getConstStr() const { 
    if(proto->getConstStr()) return proto->getConstStr().value();
    return "constant";
   }
  static ValueKind getValueKind() { return ValueKind::VK_Constant; }
};


}  // namespace lcir
 